function InvoiceCalc($VAL) {
	
	$InAmount = document.ExcInvoice.Amount.value;
	$OutAmount = document.ExcInvoice.TmpAmount.value;

	$InvType = document.ExcInvoice.operation_type.value;

	$ExcRATE = document.ExcInvoice.ExcRATE.value;

	if ($VAL == 1) {
		$Sett = $InAmount;
	}
	if ($VAL == 2) {
		$Sett = $OutAmount;
	}
	
	
	if ($VAL == 1) {
		document.ExcInvoice.TmpAmount.value = ($Sett*$ExcRATE).toFixed(2);
	}
	if ($VAL == 2) {
		document.ExcInvoice.Amount.value = ($Sett/$ExcRATE).toFixed(2);
	}	

}
function VerifyCAX() {

	$Limit = document.ExcInvoice.ExcCAX.value;
	$Amount = document.ExcInvoice.TmpAmount.value;

	if ($Amount > $Limit) {

	document.ExcInvoice.TmpAmount.value = $Limit;
	}

}